﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StringFormatting
{
    class HexadecimalConverter
    {
        public static string ToHex(string str)
        {
            byte[] bytes = Encoding.UTF8.GetBytes(str);

            StringBuilder strb = new StringBuilder();
            foreach (byte b in bytes)
            {
                strb.Append("\\x" + b.ToString("X"));
            }
            return strb.ToString();
        }
    }
}
